package com.soxing.braindata.domain.response.sync;

import com.soxing.braindata.domain.enumeration.SyncResponseEnum;
import lombok.Data;

/**
 * 同步数据返回
 */
@Data
public class SyncResponse {
    /**
     * 同步码
     */
    private int code;
    /**
     * 同步结果
     */
    private String data;

    public SyncResponse(int code, String data) {
        this.code = code;
        this.data = data;
    }

    /**
     * 成功
     *
     * @return
     */
    public static SyncResponse success() {
        return new SyncResponse(SyncResponseEnum.SUCCESS.getCode(), SyncResponseEnum.SUCCESS.getData());
    }

    /**
     * 失败
     *
     * @return
     */
    public static SyncResponse fail() {
        return new SyncResponse(SyncResponseEnum.FAIL.getCode(), SyncResponseEnum.FAIL.getData());
    }

    /**
     * 失败
     *
     * @return
     */
    public static SyncResponse fail(String message) {
        return new SyncResponse(SyncResponseEnum.FAIL.getCode(), message);
    }
}
